const
    webpack = require('webpack'),
    vendors = [
        'react', 
        'react-dom'
    ],
    fs = require('fs'),
    path = require('path'),
    appDirectory = fs.realpathSync(process.cwd()),
    resolveApp = relativePath => path.resolve(appDirectory, relativePath)
;

module.exports = {
    output: {
        path: resolveApp('public'),
        filename: '[name].[chunkhash].js',
        library: '[name]_[chunkhash]',
    },
    entry: vendors,
    plugins: [
        new webpack.DllPlugin({
          path: resolveApp('public') + '/test.json',
          name: '[name]_[chunkhash]',
          context: __dirname,
        }),
    ]
};